package com.luo.storage.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.luo.common.exception.BadRequestException;
import lombok.Getter;

@Getter
public enum UserStatus {
    FORZEN(0,"已冻结"),
    NORMAL(1,"正常使用");

    @EnumValue
    int value;
    String desc;

    UserStatus(int value,String desc){
        this.value = value;
        this.desc = desc;
    }

    public static UserStatus of(int value){
        if(value == 0 ){
            return FORZEN;
        }
        if(value == 1){
            return NORMAL;
        }
        throw new BadRequestException("账号状态错误");
    }
}
